import 'dart:async';

main() {
  // printL("zhu1");
  // // getHome();
  // printL("zhu2");
  // getData();
  // printL("zhu3");
  onFutureTest();
}

onFutureTest() {
  var f0 = Future(() => print("0"));
  var f1 = Future.delayed(Duration(milliseconds: 1), () => print("1"));
  var f2 = Future(() => print("2"));
  var f3 = Future.delayed(Duration(milliseconds: 10), () => print("3"));
  print("main0");
  f3.then((value) {
    Future.delayed(Duration(milliseconds:0), () => print("新的"));
    f2.then((value) => print("f2-then1"));
    print("f3-then3");
  });
  f1.then((value) => print("f1-then1"));
  print("main1");
}
// 1  17  2  9  16  4  5  6  8  7  10   13 15 11 12 14  3
getData() async {
  printL("1");
  await Future.delayed(Duration(milliseconds: 3000), () => printL("w我是1"));
  printL("2");
  await Future.delayed(Duration(milliseconds: 3000), () => printL("w我是2"));
  printL("3");
  await Future.delayed(Duration(milliseconds: 3000), () => printL("w我是3"));

  getHome();
}

getHome() async {
  printL("a2");
  await Future.delayed(Duration(milliseconds: 10), () {
    printL("我是a2");
  });
  printL("a3");
  await Future.delayed(Duration(milliseconds: 10), () {
    printL("我是a3");
  });
}

void printL(value) {
  print("value $value ");
}
